package com.msh.artascope.devcloud.client.qo;

import com.msh.artascope.interfaces.ILoginAccount;
import com.msh.frame.client.base.BaseProperties;
import com.msh.frame.client.base.BaseQo;
import com.msh.frame.client.validation.IList;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.Collection;
import java.util.Date;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import lombok.experimental.Accessors;

/**
 * @author shihu
 * @email m-sh@qq.com
 */
@Data
@Accessors(chain = true)
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Schema(title = "运行中制品Qo")
public class ModuleRunningQo extends BaseQo<ModuleRunningQo> {

  /**
   * 主键id
   */
  @Schema(title = "主键id")
  private Long id;

  /**
   * 制品
   */
  @Schema(title = "制品")
  private Long moduleId;

  /**
   * 制品
   */
  @Schema(title = "制品集合in查询")
  private Collection<Long> moduleIdIn;

  /**
   * 制品构建
   */
  @Schema(title = "制品构建")
  private Long moduleBuildId;

  /**
   * 环境
   */
  @Schema(title = "环境")
  private Long envId;

  /**
   * 名称
   */
  @Schema(title = "名称")
  private String name;

  /**
   * 版本
   */
  @Schema(title = "版本")
  private Integer version;

  /**
   * 分支
   */
  @Schema(title = "分支")
  private String branch;

  /**
   * 运行类型
   */
  @Schema(title = "运行类型")
  private String runningType;

  /**
   * header的key
   */
  @Schema(title = "header的key")
  private String headerKey;

  /**
   * header的value
   */
  @Schema(title = "header的value")
  private String headerValue;

  /**
   * 副本数
   */
  @Schema(title = "副本数")
  private Integer scale;

  /**
   * 租户id
   */
  @Schema(title = "租户id")
  private Long tenantId;

  /**
   * 创建时间
   */
  @Schema(title = "创建时间")
  private Date createTime;

  /**
   * 修改时间
   */
  @Schema(title = "修改时间")
  private Date updateTime;

  /**
   * 当前页数
   */
  @Min(groups = {IList.class}, value = 1, message = "currentPage从1开始")
  @Schema(title = "当前页数")
  protected Integer currentPage = 1;

  /**
   * 每页返回数量
   */
  @Min(groups = {IList.class}, value = 1, message = "pageSize最少返回1条")
  @Max(groups = {IList.class}, value = 10000, message = "pageSize最多返回10000条")
  @Schema(title = "每页返回数量")
  protected Integer pageSize = BaseProperties.MAX_PAGE_SIZE;

  public void initLoginAccount(ILoginAccount loginAccount) {
    this.tenantId = loginAccount.getTenantId();
  }


}